<form action="" {ife 'commission.level' $level}action="" method="post"{/if}  class="form-horizontal form-validate" enctype="multipart/form-data">
<input type="hidden" name="id" value="{$level['id']}" />
<input type="hidden" name="r" value="sns.level.{if empty($level['id'])}add{else}edit{/if}" />
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button data-dismiss="modal" class="close" type="button">×</button>
            <h4 class="modal-title">{if !empty($level['id'])}编辑{else}添加{/if}会员等级</h4>
        </div>
        <div class="modal-body">

            <div class="form-group">
                <label class="col-sm-2 control-label must">等级名称</label>
                <div class="col-sm-9 col-xs-12">
                    {ife 'sns.level' $level}
                    <input type="text" name="levelname" class="form-control" value="{$level['levelname']}" data-rule-required='true'/>
                    {else}
                    <div class='form-control-static'>{$level['levelname']}</div>
                    {/if}
                </div>
            </div>
            {if $id!='default'}
            <div class="form-group">
                <label class="col-sm-2 control-label">升级条件</label>
                <div class="col-sm-9 col-xs-12">
                    {ife 'sns.level' $level}
                    <div class='input-group'>
                        {if empty($set['leveltype'])}
                        <span class='input-group-addon'>社区积分达到</span>
                        <input type="text" name="credit" class="form-control" value="{$level['credit']}" />
                        <span class='input-group-addon'>分</span>
                        {/if}
                        {if $set['leveltype']==1}
                        <span class='input-group-addon'>话题达到</span>
                        <input type="text" name="post" class="form-control" value="{$level['post']}" />
                        <span class='input-group-addon'>个</span>

                        {/if}
                    </div>
                    <span class='help-block'>会员升级条件，不填写默认为不自动升级, 设置<a href="{php echo webUrl('sns/set')}">【会员升级依据】</a> </span>
                    {else}
                    <div class='form-control-static'>

                        {if empty($set['leveltype'])}
                        {if $level['credit']>0}
                        社区积分达到 {$level['credit']} 分
                        {else}
                        不自动升级
                        {/if}
                        {/if}
                        {if $set['leveltype']==1}
                        {if $level['post']>0}
                        话题达到 {$level['post']}个
                        {else}
                        不自动升级
                        {/if}
                        {/if}

                    </div>
                    {/if}
                </div>
            </div>
            {/if}

            <div class="form-group">
                <label class="col-sm-2 control-label must">标签背景</label>
                <div class="col-sm-9 col-xs-12">
                    {ife 'sns.level' $level}
                       {php echo tpl_form_field_color('bg',empty($level['bg'])?'#999':$level['bg'])}
                    {else}
                    <div class='form-control-static'>{$level['bg']}</div>
                    {/if}
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label must">标签颜色</label>
                <div class="col-sm-9 col-xs-12">
                    {ife 'sns.level' $level}
                    {php echo tpl_form_field_color('color',empty($level['color'])?'#333':$level['color'])}
                    {else}
                    <div class='form-control-static'>{$level['color']}</div>
                    {/if}
                </div>
            </div>

        </div>
        <div class="modal-footer">
            <button class="btn btn-primary" type="submit">提交</button>
            <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
        </div>
    </div>
    </form>
